import request from "@/request/model/request.js";
import Method from "@/request/model/method.js";
import {callbackCode, callbackData} from "@/request/model/requestCallback.js";


export const r_p_list = () => {
    return request('/api/pool/list', Method.GET)
        .then(rs => callbackData(rs));
}

export const r_p_getByPoolId = (poolId) => {
    return request(`/api/pool/get/${poolId}`, Method.GET)
        .then(rs => callbackData(rs));
}

export const r_p_save = (poolAddDTO) => {
    return request('/api/pool/save', Method.POST, null, poolAddDTO)
        .then(rs => callbackCode(rs));
}

export const r_p_update = (poolUpdateDTO) => {
    return request('/api/pool/update', Method.PUT, null, poolUpdateDTO)
        .then(rs => callbackCode(rs));
}

export const r_p_delete = (poolId) => {
    return request(`/api/pool/delete/${poolId}`, Method.DELETE)
        .then(rs => callbackCode(rs));
}
